package cm.day05.Test3;

import java.util.Arrays;

public class RandomNumHandlerDemo {
    public static void main(String[] args) {
        useRandomNumHandler(new RandomNumHandler() {
            @Override
            public int getNumber() {
                return 1;
            }
        });
        //lambda表达式
        useRandomNumHandler(() -> {
            return 1;
        });
//lambda简化式
        useRandomNumHandler(()->1);
    }

    public static void useRandomNumHandler(RandomNumHandler randomNumHandler) {
        int num = randomNumHandler.getNumber();
        System.out.println(num);
    }
}
